class MyThread4 extends Thread{
    @Override
    public void run() {
        while (true) {
            System.out.println("hello run");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
public class ThreadDemo11 {
    public static void main(String[] args) throws InterruptedException {
        Thread t = new MyThread4();
        t.start(); //创建一个新线程，由新的线程执行hello
//        t.run();//在main主线程中打印hello
        while (true){
            System.out.println("hello main");
            Thread.sleep(1000);
        }
    }
}
